
function add(){
	
		book = new Array(5);
		
		book[0] = document.getElementById('book1').value;
		book[1] = document.getElementById('book2').value;
		book[2] = document.getElementById('book3').value;
		book[3] = document.getElementById('book4').value;
		book[4] = document.getElementById('book5').value;
		
		function getSumfor(book){   
		    var sum = 0;	
		    for(var i = 0;i<book.length;i++){		
		        sum += Number(book[i]);	
		    }	
		    return sum ;
		}
		var result = getSumfor(book);
		
		window.alert("您购买的图书总金额为："+ String(result) + "元。\n打七折后应付的价格为："+ String(Math.ceil(result * 0.7)) + "元。");
	
}

function loose(){
	var str = window.prompt("请您输入需要找零的金额：");
	window.alert(str);
}